<?php
namespace App\Models\City;
use App\Libs\Base\Constant;
use App\Models\City\City;
use App\Models\City\Province;
class Area extends \App\Libs\Base\BaseModel
{
    protected $__TABLE__ = 't_jia_areas';

	public function beforeValidation()
	{
	  self::skipValidation([] , $this );
	}

	public static function getFullAddr($areaid){
	    if(empty($areaid)){
	        return '请设置地址';
        }
	    $matcharea = self::findOne('areaid='.$areaid);
	    if(empty($matcharea)){
	        return '地址有误';
        }
	    $areaname = $matcharea->area;
	    $city = City::findOne('cityid='.$matcharea->cityid);
	    $cityname = $city->city;
	    $province = Province::findOne('provinceid='.$city->provinceid);
	    $provincename = $province->province;
	    return $provincename.$cityname.$areaname;
    }
	
}
